package com.ruoyi.stockLogs.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.stockLogs.service.IStockLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stockLogs.mapper.StockLogsMapper;
import com.ruoyi.stockLogs.domain.StockLogs;

/**
 * 库存变动日志Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-16
 */
@Service
public class StockLogsServiceImpl implements IStockLogsService
{
    @Autowired
    private StockLogsMapper stockLogsMapper;

    /**
     * 查询库存变动日志
     * 
     * @param logId 库存变动日志主键
     * @return 库存变动日志
     */
    @Override
    public StockLogs selectStockLogsByLogId(Long logId)
    {
        return stockLogsMapper.selectStockLogsByLogId(logId);
    }

    /**
     * 查询库存变动日志列表
     * 
     * @param stockLogs 库存变动日志
     * @return 库存变动日志
     */
    @Override
    public List<StockLogs> selectStockLogsList(StockLogs stockLogs)
    {
        return stockLogsMapper.selectStockLogsList(stockLogs);
    }

    /**
     * 新增库存变动日志
     * 
     * @param stockLogs 库存变动日志
     * @return 结果
     */
    @Override
    public int insertStockLogs(StockLogs stockLogs)
    {
        stockLogs.setCreateBy(SecurityUtils.getUsername());
        stockLogs.setCreateTime(DateUtils.getNowDate());
        return stockLogsMapper.insertStockLogs(stockLogs);
    }

    /**
     * 修改库存变动日志
     * 
     * @param stockLogs 库存变动日志
     * @return 结果
     */
    @Override
    public int updateStockLogs(StockLogs stockLogs)
    {
        stockLogs.setUpdateBy(SecurityUtils.getUsername());
        stockLogs.setUpdateTime(DateUtils.getNowDate());
        return stockLogsMapper.updateStockLogs(stockLogs);
    }

    /**
     * 批量删除库存变动日志
     * 
     * @param logIds 需要删除的库存变动日志主键
     * @return 结果
     */
    @Override
    public int deleteStockLogsByLogIds(Long[] logIds)
    {
        return stockLogsMapper.deleteStockLogsByLogIds(logIds);
    }

    /**
     * 删除库存变动日志信息
     * 
     * @param logId 库存变动日志主键
     * @return 结果
     */
    @Override
    public int deleteStockLogsByLogId(Long logId)
    {
        return stockLogsMapper.deleteStockLogsByLogId(logId);
    }
}
